using System;

namespace Infinity.Expressions.Utilities
{
	public interface ICastManager
	{
		Type[] GetRuleFrom(Type type);

		/// <summary>
		/// It returns true if there is casting rule between 'from' -> 'to'.
		/// </summary>
		bool CanCast(Type from, Type to);

		/// <summary>
		/// It adds new type casting rule. If isSymmetric is true then rule will be from &lt;-&gt; to, otherwise from -&gt; to.
		/// </summary>
		void AddRule(Type from, Type to, bool isSymmetric);

		/// <summary>
		/// It clears rules.
		/// </summary>
		void ClearRules();

		/// <summary>
		/// It adds new type casting rule. If isSymmetric is true then rule will be from &lt;-&gt; to, otherwise from -&gt; to.
		/// </summary>
		void AddRule<TFrom, TTo>(bool isSymmetric = true);

		/// <summary>
		/// It adds a new type casting rule.
		/// </summary>
		void AddRules(Type[] from, Type[] to, CastManagerRuleType ruleType = CastManagerRuleType.Combinatorical);
	}
}